<?php
declare(strict_types=1);
namespace Field;

class OneCampaignGroupConst
{
    public const pk='';
    public const index=['bizCode','campaignGroupId'];
	public const fields=['bizCode','campaignGroupId','campaignGroupName'];
	public const comment=['bizCode'=>'','campaignGroupId'=>'','campaignGroupName'=>''];
	/*
    * @Field bizCode
    * @Type int(10)
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const bizCode = 'bizCode';
    /*
    * @Field campaignGroupId
    * @Type bigint(20)
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const campaignGroupId = 'campaignGroupId';
    /*
    * @Field campaignGroupName
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const campaignGroupName = 'campaignGroupName';
}

class OneCampaignGroupColumns
{
public  int $bizCode;
   public  int $campaignGroupId;
   public  ?string $campaignGroupName='';
	public function toArray():array
	{
		return [
'bizCode'=>$this->bizCode,
    'campaignGroupId'=>$this->campaignGroupId,
    'campaignGroupName'=>$this->campaignGroupName,        ];
	}
}

class OneCampaignGroupRow
{
	public OneCampaignGroupColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'bizCode' => $this->data->bizCode,
        'campaignGroupId' => $this->data->campaignGroupId,
        'campaignGroupName' => $this->data->campaignGroupName, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new OneCampaignGroupColumns();
        isset($data['bizCode']) && $this->data->bizCode = (int)$data['bizCode'];
           isset($data['campaignGroupId']) && $this->data->campaignGroupId = (int)$data['campaignGroupId'];
           isset($data['campaignGroupName']) && $this->data->campaignGroupName = (string)$data['campaignGroupName'];
    }
}
?>